﻿@{
    ViewBag.Title = "LoadCreator";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="/js/tabletocsv.js"></script>
<script src="~/js/load.js"></script>
<input type="hidden" id="hfloadid" value="0"/>
<input type="hidden" id="hfwarehouseid" value=""/>
<div class="container-fluid">
    <div class="page-header"></div>
    <form action="/load/LoadUnplannedOrders" method="POST" class="margin0" id="fr-LoadUnplannedOrders">
        <div class="row-fluid">
            <div class="span4">
                <br />
                <input type="button" class="btn btn-primary" value="Export boxed items" style="width: 200px;" 
                    onclick="PopupCenter('/load/exportboxeditems',980,650)" /><br />
                <br />
                <input type="button" class="btn btn-danger" value="View Failed Delivery Order(@ViewBag.ViewFailed)" 
                       style="width: 200px;" onclick="PopupCenter('/load/viewfaildeliveryorder', 900, 650)" />
            </div>
            <div class="fieldset span3">
                <div class="legend"><span>Move warehouses</span></div>
                <div class="row-fluid">
                    @Html.DropDownList("MoveToWarehouseID", null, new { @class = "input-block-level" })
                    <input type="button" class="btn btn-primary" value="Move warehouse" style="width: 100%"
                        onclick="movewarehouseunplanneditem()" />
                </div>
            </div>
            <div class="fieldset span5">
                <div class="row-fluid">
                    <div class="span3">Warehouse</div>
                    <div class="span6">
                        @Html.DropDownList("WarehouseID", null, new { @class = "input-block-level" })
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span3">Carrier</div>
                    <div class="span6">
                        @Html.DropDownList("CarrierID", null, new { @class = "input-block-level" })
                    </div>
                    <div class="span3">
                        <input type="submit" class="btn btn-primary" value="Refresh" style="width: 100%" />
                    </div>
                </div>
            </div>
        </div>
        <div class="border-padding10">
            <div class="row-fluid">
                <div class="span5">Unplanned order items</div>
                <div class="span7 text-right">
                    @*<label style="float: right">
                        <input type="checkbox" class="cbcheck" name="Showselecteditemsonly" />
                        Show selected items only</label>*@
                    <label style="margin: 0 25px; float: right">
                        <input type="checkbox" class="cbcheck" name="Selectthewholeorder" checked="checked" />
                        Select the whole order</label>
                </div>
            </div>
            <div class="UnplannedOrderItems" style="margin-bottom: 10px">
                <table class="table table-bordered table-fix krmtable" data-height="200">
                    <thead>
                        <tr>
                            <th>Warning</th>
                            <th>Assembly</th>
                            <th>DeliveryDate</th>
                            <th>OrderRef</th>
                            <th>PostCode</th>
                            <th>Product</th>
                            <th>Qty</th>
                            <th>Special Instructions</th>
                            <th>Weight</th>
                            <th>Packages</th>
                            <th>Customer</th>
                            <th>Address</th>
                            <th>Email</th>
                            <th>DatePlaced</th>
                        </tr>
                    </thead>
                </table>
            </div>
            <div class="row-fluid">
                <input type="button" class="btn btn-success" value="Add to selected load" onclick="addtoselectedload()" />
                <input type="button" class="btn btn-primary btn-movecarrier" value="Move carrier" style="margin: 0 10px" />
                @*<input type="button" class="btn btn-primary" value="Import select item csv" style="margin-right: 10px" />
                <input type="button" class="btn btn-primary" value="Import from Paragon" />*@
            </div>
        </div>
    </form>
    <div class="border-padding10">
        <div class="row-fluid">
            <div class="span4">
                <div class="border-padding10">
                    <p>Unplanned Loads</p>
                    <div style="margin-bottom: 10px">
                        <div class="dgvUnplannedLoads">
                            <table class="table table-bordered table-fix krmtable" data-height="200">
                                <thead>
                                    <tr>
                                        <th>Status</th>
                                        <th>LoadCode</th>
                                        <th></th>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span8">
                            <input type="button" class="btn btn-success" value="New Load" onclick="loadcreatoraddnewload()" />
                            <button class="btn btn-danger btn-removeload" type="button"><i class="icon-trash"></i></button>
                        </div>
                        <div class="span4 text-right">
                            <button class="btn btn-primary" type="button" onclick="refreshload()"><i class="icon-refresh"></i></button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="span8">
                <div class="border-padding10">
                    <div style="margin-top: 30px; margin-bottom: 10px">
                        <div class="dgvLoadItems">
                            <table class="table table-bordered table-fix krmtable tbloaditem" data-height="200">
                                <thead>
                                    <tr>
                                        <th>Selected</th>
                                        <th>Status</th>
                                        <th>Postcode</th>
                                        <th>OrderRef</th>
                                        <th>DatePlaced</th>
                                        <th>SpecialInstructions</th>
                                        <th>Product</th>
                                        <th>Weight</th>
                                        <th>Customer</th>
                                        <th>Qty</th>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                    <div class="text-right">
                        <input type="button" class="btn btn-primary" value="Export to AutoRoute" onclick="ExportCSVWithHead($('.tbloaditem'), 'Table.csv', $('.theadloaditem'))" />
                        <input type="button" class="btn btn-primary" value="Move Items" onclick="moveitemselected()" />
                        <input type="button" class="btn btn-danger" value="Remove Items" onclick="removeitemsselected()" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="border-padding10">
        <div class="loadcreatorloaddetail">
            <div class="row-fluid">
                <div class="span2">
                    <h3>SD000001</h3>
                    <p>Load status: UNPLANNED</p>
                </div>
                <div class="span10">
                    <div class="row-fluid">
                        <div class="span2">Items Qty:</div>
                        <div class="span1">0</div>
                        <div class="span1">Vehicle</div>
                        <div class="span2">
                            <select class="input-block-level"></select>
                        </div>
                        <div class="span2">Despatched Date:</div>
                        <div class="span2">
                            <div class="input-append datetimepicker">
                                <input data-format="dd/MM/yyyy" type="text" name="DespatchedDate"  style="width: 65%">
                                <span class="add-on">
                                    <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span2">Packages Qty:</div>
                        <div class="span1">0</div>
                        <div class="span3">Vehicle max weight: 0</div>
                        <div class="span2">Delivery Date:</div>
                        <div class="span2">
                            <div class="input-append datetimepicker">
                                <input data-format="dd/MM/yyyy" type="text" name="DeliveryDate"  style="width: 65%">
                                <span class="add-on">
                                    <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span2">Total Weight:</div>
                        <div class="span1">0</div>
                        <div class="span1">Driver</div>
                        <div class="span2">
                            <select class="input-block-level"></select>
                        </div>
                        <div class="span2">Bay Number:</div>
                        <div class="span2">
                            <input type="text" class="input-block-level" />
                        </div>
                        <div class="span2">
                            <input type="button" class="btn btn-primary" value="Confirm Load" style="width: 100%" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="actionscript"></div>
</div>

<div id="MoveWarehouse" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="MoveWarehouse" aria-hidden="true">
    <form action="/load/loadcreatormovewarehouse" class="margin0" id="fr-loadcreatormovewarehouse" method="POST">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
            <h5>Move Warehouse</h5>
        </div>
        <div class="modal-body">
            <div class="row-fluid">
                <div class="span3"></div>
                <div class="span6">
                    @Html.DropDownList("NewWarehouseID", null, new { @class = "input-block-level newwarehouseid" })
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn btn-primary" type="submit">Move warehouse</button>
            <button class="btn w90" data-dismiss="modal" aria-hidden="true">Cancel</button>
        </div>
    </form>
</div>